package com.jerry.quartz;

import com.jerry.quartz.domain.SchedluerTask;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * Created by Shirly on 2016/12/14.
 */
@Service
public interface TaskService {
    public Map<String,Object> getAllCron();

    public List<SchedluerTask> getAllTask();

    public SchedluerTask getTaskById(String taskId);

    public SchedluerTask addTask(SchedluerTask task) throws Exception;

    public SchedluerTask addTask(String taskName,String taskClassName,String triggerName,String cron) throws Exception;

    public SchedluerTask addtask(String taskName,String taskClassName,String taskGroupName,String triggerName,String triggerGroupName,String cron);

    /**
     * 通过任务id修改任务（默认使用触发器名称，任务类名称，cron表达式）
     * @param taskId
     * @param cron
     * @return
     */
    public SchedluerTask modifyTask(String taskId,String cron);

    /**
     * 通过id删除任务
     * @param taskId
     * @return
     */
    public SchedluerTask removeTask(String taskId);

    public SchedluerTask pauseTask(String taskId);

    public SchedluerTask disableTask(String taskId);

    public void startAllTask();

    public void shutdownAllTask();
}
